/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GamePlay;
import FrameWork.IPlay;
import FrameWork.IState;
import FrameWork.Rectangle;
import java.io.IOException;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;
/**
 *
 * @author ThanhTri
 */
public class State_About extends IState {
    Rectangle m_BBack;
    private Sprite m_SBack,m_SAbout,m_SButton;
     public State_About(IPlay _Play){
        super(_Play);
        m_IDState = Global.STATE_ABOUT ;
    }
    
    public void Init (){
        super.Init();
        try {
            m_SBack = new Sprite(Image.createImage("/image/menu.png"),
                                240, 320);
            m_SAbout = new Sprite (Image.createImage("/image/About.png"),
                                240, 320);
            m_SButton = new Sprite (Image.createImage("/image/bt.png"),
                            64, 64);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        m_BBack = new Rectangle(88, 256, 64, 64);
        
    }
    
    public void Update (float _Time){
        
    }
    public void PointerPressed(int x, int y){
        if(m_BBack.Intersects(x, y))
           m_Play.setNextState(new State_Start(m_Play));
    }
    public void KeyPressed (int _Keycode){
       if (_Keycode == -5 || _Keycode ==53){
           m_Play.setNextState(new State_Start(m_Play));
       }
    }
    
    public void Render (){        
        super.Render();
        m_Graphics.setColor(200, 0, 0);
        m_Graphics.fillRect(0, 0, 240, 320);
        m_SBack.paint(m_Graphics);
        m_SAbout.paint(m_Graphics);
        m_SButton.setPosition(88, 256);
        m_SButton.setFrame(3);
        m_SButton.paint(m_Graphics);
       
    }
}
